﻿@{
    ViewBag.Title = "Ins";
}
@section scripts
{   
    <script src="@Url.Content("~/Scripts/shared/share.js")" type="text/javascript"></script> 
    <script src="@Url.Content("~/Scripts/shared/shown.js")" type="text/javascript"></script>  
    <script src="@Url.Content("~/Scripts/common/gridlayout.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/common/export.js")" type="text/javascript"></script>
}
<body>
   <form id="form1" runat="server" method="post" style="height: 100%">
    
    @Html.Partial("~/Views/Modular/BillDetailToolbar.cshtml")
    
    <div id = "DivHeader">
        <table style="margin-bottom:4px;">
            <tr>
                <td width ="70px" align="right">单据日期：</td>
                <td width ="310px">
                    @Html.Partial("~/Views/Modular/dxDateRange.cshtml") 
                </td>
                <td width ="70px" align="right">审核状态：</td>
                <td width ="87px">
                    <input id="comCheckFlag" name ="FCheckFlag" class="mini-combobox" style="width:87px;" 
                    showNullItem="false" required="true" allowInput="false" align="left" data ="dCheckFlag"/>  
                </td>
                <td width ="73px" align="right">单据类型：</td>
                <td width ="150px">
                    <input id="comBillType" name ="FBillType" class="mini-combobox" style="width:150px;" 
                    showNullItem="false" required="true" allowInput="false" align="left" data ="dBillType"/>                    
                </td>
            </tr>
        </table>
        <table>
            <tr>
                <td width ="70px" align="right">订单会员：</td>
                <td width ="200px">    
                     @Html.Partial("~/Views/Modular/LookupWeixinInfo.cshtml")                      
                </td>
                <td width ="70px" align="right">门店名称：</td>
                <td width ="190px">    
                    @Html.Partial("~/Views/Modular/LookupStockInfo.cshtml")                      
                </td>
                <td width ="70px" align="right">单据编号：</td>
                <td width ="150px">
                    <input name="FBillNo" class="mini-textbox" style="width:150px;"/>
                </td>
            </tr>
            <tr>
                <td width ="70px" align="right">收件人：</td>
                <td width ="200px">
                    <input name="FConsignee" class="mini-textbox" style="width:200px;"/>
                </td>
                <td width ="70px" align="right">商品分类：</td>
                <td width ="190px">    
                    @Html.Partial("~/Views/Modular/LookupGoodsClass.cshtml")                       
                </td>
                <td width ="70px" align="right">商品搜索：</td>
                <td width ="150px">
                    <input name="FNumber" class="mini-textbox" style="width:150px;"/>
                </td>
            </tr>
        </table>
    </div>
    <div class="mini-fit">
        <div id="datagrid1" class="mini-datagrid" style="width:100%;height:100%;" borderStyle="border:1;"pageSize="15"
            url="../Report/GetBillDetail"
            allowCellSelect="true" allowCellEdit="true" showSummaryRow="true" ondrawsummarycell="onDrawSummaryCell"
            fitColumns="false" onrowdblclick="editBill" sortMode="client">
            <div property="columns">
                <div type="checkcolumn" ></div>  
                <div field="FBillNo" width="120" headerAlign="center">订单编号</div>    
                <div field="FDate" width="90px"  headerAlign="center">单据日期</div> 
                <div field="FNumber" width="90" headerAlign="center">商品编码</div>
                <div field="FName" width="130" headerAlign="center">商品名称</div>
                <div field="FSpec" width="80" headerAlign="center">规格型号</div>
                <div field="FUnitName" width="40" headerAlign="center">单位</div>
                <div field="mFQty" name="mFQty" width="70" headerAlign="center"align="right"numberFormat="#,0.00">数量</div>
                <div field="mFPrice" name="mFPrice" width="70" headerAlign="center"align="right"numberFormat="#,0.00">单价</div>
                <div field="mFAmount" name="mFAmount" width="90" headerAlign="center"align="right"numberFormat="#,0.00">金额</div>
                <div field="FCode" width="100" headerAlign="center">商品条码</div>
                <div field="mFRemark" width="120" headerAlign="center">明细备注</div>
                <div field="FConsignee" width="100" headerAlign="center">收件人</div>
                <div field="FAddress" width="150" headerAlign="center">收货地址</div>
                <div field="FTelephone" width="120" headerAlign="center">联系电话</div>
                <div field="FStockName" width="100" headerAlign="center">门店名称</div>
                <div field="FRemark" width="120" headerAlign="center">备注</div>
            </div>
        </div>  
    </div>
    
    <script type="text/javascript">

        var dBillType = [{ "id": "0", "text": "全部" },
                         { "id": "1", "text": "订单" },
                         { "id": "2", "text": "退货" }]

        var dCheckFlag = [{ "id": "0", "text": "全部" },
                         { "id": "1", "text": "未审核" },
                         { "id": "2", "text": "已审核" }]

        mini.parse();
        var form = new mini.Form("form1");
        var grid = mini.get("datagrid1");
        var uID = parent.window.getSystemAppID();
        var hdatatype = getQueryString("datatype");
        var sumFields = "mFQty,mFAmount";

        function FormShown() {
            var nowDate = new Date();
            mini.getbyName("FDate1").setValue(nowDate);
            mini.getbyName("FDate2").setValue(nowDate);
            mini.getbyName("FCheckFlag").select(0);
            mini.getbyName("FBillType").select(0);
            LoadData();
        }

        function clearloca() {
            mini.getbyName("FStockID").setValue("");
            mini.getbyName("FStockID").setText("");
            mini.getbyName("FStockName").setValue("");
            mini.getbyName("FWeixinID").setValue("");
            mini.getbyName("FWeixinID").setText("");
            mini.getbyName("FWeixinName").setValue("");
            mini.getbyName("FClassNumber").setValue("");
            mini.getbyName("FClassNumber").setText("");
            mini.getbyName("FGoodsClassName").setValue("");
            mini.getbyName("FBillNo").setValue("");
            mini.getbyName("FNumber").setValue("");
            mini.getbyName("FConsignee").setValue("");
        }

        function editBill() {
            if (!mini.get("editbill").getVisible()) return;
            var row = grid.getSelected();
            if (row) {
                var mDataType = row.FDataType;
                if (mDataType == 5) {
                    parent.window.showTabByIdEx('77', 'MallData', '订单管理', '../Bill/MallData?datatype=5&billid=' + row.KInterID);
                }
            }
        }

        function LoadData() {
            var cDate1 = mini.getbyName("FDate1").getFormValue();
            var cDate2 = mini.getbyName("FDate2").getFormValue();
            var mCheckFlag = mini.getbyName("FCheckFlag").getValue();
            var mBillType = mini.getbyName("FBillType").getValue();
            var mBillNo = mini.getbyName("FBillNo").getValue();
            var mStockID = mini.getbyName("FStockID").getValue();
            var mWeixinID = mini.getbyName("FWeixinID").getValue();
            var mClassID = mini.getbyName("FClassNumber").getValue();
            var mConsignee = mini.getbyName("FConsignee").getValue();
            var mNumber = mini.getbyName("FNumber").getValue();

            var json = "[{";
            json = json + '"mListType":' + '"' + hdatatype + '",';//列表类型
            json = json + '"mSystemAppID":' + '"' + uID + '",';
            json = json + '"mDate1":' + '"' + cDate1 + '",';
            json = json + '"mDate2":' + '"' + cDate2 + '",';
            json = json + '"mCheckFlag":' + '"' + mCheckFlag + '",';
            json = json + '"mBillType":' + '"' + mBillType + '",';
            json = json + '"mStockID":' + '"' + mStockID + '",';
            json = json + '"mObjectID":' + '"' + mWeixinID + '",';
            json = json + '"mClassID":' + '"' + mClassID + '",';
            json = json + '"mConsignee":' + '"' + mConsignee + '",';
            json = json + '"mNumber":' + '"' + mNumber + '",';
            json = json + '"mBillNo":' + '"' + mBillNo + '"';
            json = json + "}]";

            grid.load({ mydata: json });

            mExportDataUrl = grid.url;
            mExportDataJson = json;//导出
        }
        function printdata() {
            var url = "../Report/PrintReport";
            mini.open({
                url: url,
                title: "打印", width: 1000, height: 700,
                onload: function () {
                    var iframe = this.getIFrameEl();
                    var NoneDisplayCol = [0];
                    iframe.contentWindow.InitalPrint(grid, NoneDisplayCol, parent.window.getSystemCompany() + "电商订单明细表");
                }
            });
        }

    </script>

    </form>
</body>